module.exports = function ($scope, $resource, $modalInstance, address, toaster, FileUploader) {
    $scope.address;
    $scope.url = '/api/as/ggc/address/save'
    if (address) {
        $scope.address = address;
        $scope.url = '/api/as/ggc/address/update'
    } else {
        $scope.address = {};
    }

    //添加影院
    $scope.ok = function () {
        $resource($scope.url, {}, {}).save($scope.address, function (res) {
            if (res.errcode === 0) {
                $modalInstance.close();
            } else if(errcode === 1105){
                toaster.warning({ title: '', body: '已有人在此地点上车，不可更改' });
            } else {
                toaster.error({ title: '', body: res.errmsg });
            }
        });
    }

    //取消
    $scope.close = function () {
        $modalInstance.dismiss('cancel');
    }
};